import { release } from "os";

import { RuleContent } from "./rule";

function getOSName() {
    let raw = process.platform;
    if (raw=="darwin") return "osx";
    if (raw=="win32") return "windows";
    return "linux";
}

function getOSArch() {
    let raw = process.arch;
    if (raw == "x64") return "x64";
    if (raw == "ia32") return "x86";
    if (raw == "arm" || raw == "arm64") return raw;
    return "x64";
}

const osRules = {
    "name" : getOSName(),
    "version": "", // release().slice(0,2) == "10" ? "^10\\." : "",
    "arch": getOSArch()
};

const DEBUG = true;

const LAUNCHER_NAME = "SLC/Sami Launcher Core";
const LAUNCHER_VERSION = "0.0.1";

export default class Constants {
    static get osRules() : RuleContent {
        return {
            "os": osRules
        }
    }

    static get debug() : boolean {return DEBUG;} 
    static get launcherName(): string {return LAUNCHER_NAME};
    static get launcherVersion(): string {return LAUNCHER_VERSION};
    static get microsoftLoginURL(): string {return "https://login.live.com/oauth20_authorize.srf?client_id=00000000402b5328&response_type=code&scope=service%3A%3Auser.auth.xboxlive.com%3A%3AMBI_SSL&redirect_uri=https%3A%2F%2Flogin.live.com%2Foauth20_desktop.srf"};
}

